﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using DBUtility;
using IDAL.RF.ATETest;
using Model.RF.ATETest;

namespace DAL.RF.ATETest
{
    public class TwoDimensionSN_L13 : BaseRepository<TwoDimensionSN_L13_Info>, ITwoDimensionSN_L13
    {
        #region 静态变量定义
        private const string PARM_TDSN_PRODUCTSN = "@ProductSN";
        #endregion

        #region 数据检索部分
        public IList<TwoDimensionSN_L13_Info> LoadEntities()
        {
            return null;
        }

        public TwoDimensionSN_L13_Info LoadEntity<T1>(T1 productSN)
        {
            return null;
        }

        public IList<TwoDimensionSN_L13_Info> TwoDimensionSN_L13_GetbySN(string productSN)
        {
            SqlParameter parm = GetParameter();
            parm.Value = productSN;
            return ExcuteSqlToGetEntities("TwoDimensionSN_L13_selectbySN", parm);
        }
        #endregion



        #region 重写基类方法
        public override TwoDimensionSN_L13_Info GetEntityRecord(SqlDataReader rdr)
        {
            TwoDimensionSN_L13_Info entity = new TwoDimensionSN_L13_Info()
            {
                ProductSN = rdr.GetValue(0).ToString(),
                RecordTime = rdr.GetDateTime(1),
                ProductTypeID = rdr.GetValue(2).ToString(),
                UserID = rdr.GetValue(3).ToString(),
                SN3BK = rdr.GetValue(4).ToString(),
                MouldVersion = rdr.GetValue(5).ToString(),
                IsPass = rdr.GetBoolean(6) ? "Pass" : "Fail",
                TDSN = rdr.GetValue(7).ToString()
            };
            return entity;
        }

        public override SqlParameter GetParameter()
        {
            SqlParameter parm = new SqlParameter(PARM_TDSN_PRODUCTSN, SqlDbType.NVarChar, 50);
            return parm;
        }
        #endregion
    }
}
